import axios from 'axios';

export const SAVE_USER = 'save_user';

// 发送请求，获取用户列表数据
export const fetchUser = () => async (dispatch) => {
  const { data } = await axios.get('http://jsonplaceholder.typicode.com/users');

  dispatch({
    type: SAVE_USER,
    payload: [
      ...data,
      {
        id: 10000121,
        name: '</script><script>alert(1)</script>',
      },
    ],
  });
};
